import { default as request, cloud } from '@/framework/utils/request'

export default ({

  // 获取应用列表
  fetchList(params) {
    return request({
      url: cloud.dqbasic + '/sysApp/page',
      method: 'get',
      params
    })
  },

  // 添加应用
  addApp(data) {
    return request({
      url: cloud.dqbasic + '/sysApp/add',
      method: 'post',
      data
    })
  },

  // 获取应用数据
  getAppById(id) {
    return request({
      url: cloud.dqbasic + '/sysApp/detail',
      method: 'get',
      params: {
        'appId': id
      }
    })
  },

  // 修改应用
  updateApp(data) {
    return request({
      url: cloud.dqbasic + '/sysApp/edit',
      method: 'post',
      data
    })
  },

  // 删除角色
  deleteApp(id) {
    return request({
      url: cloud.dqbasic + '/sysApp/delete',
      method: 'post',
      data: {
        'appId': id
      }
    })
  },

  // 更新激活状态
  updateActiveFlag(id) {
    return request({
      url: cloud.dqbasic + '/sysApp/updateActiveFlag',
      method: 'post',
      data: {
        'appId': id
      }
    })
  },

  // 更新启用状态
  updateStatus(id, statusFlag) {
    return request({
      url: cloud.dqbasic + '/sysApp/updateStatus',
      method: 'post',
      data: {
        'appId': id,
        'statusFlag': statusFlag
      }
    })
  }

})
